package com.zmn.plat.dubbo.impl.orderconfig.track.category;

import java.util.List;

import javax.annotation.Resource;

import org.apache.dubbo.config.annotation.Service;

import com.zmn.common.constant.GlobalConsts;
import com.zmn.common.dto2.ResponseDTO;
import com.zmn.plat.business.interfaces.orderconfig.track.category.OrderTrackCategoryBService;
import com.zmn.plat.common.dto.orderconfig.track.category.OrderTrackCategoryDRO;
import com.zmn.plat.common.exception.PlatException;
import com.zmn.plat.dubbo.interfaces.orderconfig.track.category.OrderTrackCategoryListRemoteService;
import com.zmn.plat.dubbo.utils.DubboConsts;

import lombok.extern.slf4j.Slf4j;

/**
 * @author tanbiao
 * @description
 * @modifier
 * @since 2020/12/3 14:09
 **/
@Service(version = DubboConsts.INTERFACE_VERSION, validation = "true")
@Slf4j
public class OrderTrackCategoryListRemoteServiceImpl implements OrderTrackCategoryListRemoteService {
    @Resource
    private OrderTrackCategoryBService orderTrackCategoryBService;

    @Override
    public ResponseDTO<List<OrderTrackCategoryDRO>> listByStatus(Integer status) {
        log.info("listByStatus status:{}", status);

        try {
            List<OrderTrackCategoryDRO> list = orderTrackCategoryBService.listByStatus(status);
            return ResponseDTO.success(list);
        } catch (PlatException e) {
            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
        } catch (Exception e) {
            log.error("listByStatus error.status={}", status, e);
            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
        }
    }
}
